<?php defined('RUN_KATANA') or die('Restricted access'); ?>
<?php 
$buttons_l[0]['image'] = "csv_16.png";
$buttons_l[0]['onclick'] = "csvExport();";
$buttons_l[0]['title'] = ucfirst($txt->getWord('export'));
//echo $commander->getListCommandsPanel('shipping_methods-period-reload', '', $buttons_l);
?>
<div class="menu_list">
	<table style="clear:both;" id="orders_<?php echo $report; ?>" class="item_list" cellspacing="0" cellpadding="0" border="0">
        <thead class="fields">
            <tr>
            	<th class="first center">&nbsp;&nbsp;Id&nbsp;&nbsp;</th>
				<th><?php echo ucfirst($txt->getWord('survey')); ?></th>
				<th><?php echo ucfirst($txt->getWord('answers')); ?></th>
				<th class="center">%</th>
				<th class="header last"><?php echo ucfirst($txt->getWord('values')); ?></th>
            </tr>
        </thead>
        <tbody><?php echo $commander->getComponentListLoading(); ?></tbody>
    </table>
</div>
<?php 
$dateStart = date('Y-m-').'01';
$dateEnd = date('Y-m-t');
if($_REQUEST['date_start'] != '')
{ $dateStart = $_REQUEST['date_start']; }
if($_REQUEST['date_end'] != '')
{ $dateEnd = $_REQUEST['date_end']; }
?>
<script type="text/javascript">
jQuery(document).ready(function() 
{
	setPeriod();
	loadTableData<?php echo $report; ?>();
});
function loadTableData<?php echo $report; ?>()
{
	jQuery.ajax(
	{
		url: "ajax.php<?php echo $commander->getFormAction('ajax'); ?>&date_start=<?php echo $dateStart; ?>&date_end=<?php echo $dateEnd; ?>",
		cache: false,
	  	success: function(html)
	  	{ 
			jQuery('table#orders_<?php echo $report; ?> tr.loading').remove();
			jQuery("table#orders_<?php echo $report; ?> tbody").append(html); 
			jQuery('table#orders_<?php echo $report; ?>.item_list tr.loading').remove();
		}
	});
}

function displayValuesDialog(id)
{
	alert(id);
	jQuery('#'+id).dialog('open');
	jQuery('#'+id).dialog({
		bgiframe: true,
		resizable: false,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('close')); ?>': function() 
			{ jQuery(this).dialog('close'); }
		}
	});
}
</script>
<div id="export_dialog" title="<?php echo ucfirst($txt->getWord('download').' '.$txt->getWord('report')); ?>?" style="display:none; text-align:left;">
	<div id="csv"></div>
</div><div class="clear"></div>